<script type="text/javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript">
  $(document).ready(function() { 
    $("#startTime").click(function() {
      WdatePicker({
        dateFmt:'yyyy-MM-dd',
        readOnly:true
      });
    });         
  });
</script>
<script language="JavaScript">
function checkFrom()
{
	var pname = document.getElementById("pname").value;
	//alert(pname);
	if(pname.length==0)
	{
		document.getElementById("pNameMsg").style.display = "inline-block";
		return false;
	}
	else
	{
		document.getElementById("pNameMsg").style.display = "none";
	}
	
	var buildUnit = document.getElementById("buildUnit").value;
	var constructUnit = document.getElementById("constructUnit").value;
	var supervisorUnit = document.getElementById("supervisorUnit").value;
	var designUnit = document.getElementById("designUnit").value;
	if(buildUnit.length==0 && constructUnit.length==0 && supervisorUnit.length==0 && designUnit.length==0)
	{
		alert("请至少输入一个单位名称！");
		document.getElementById("unitMsg").style.display = "inline-block";
		return false;
	}
	
	var startTime = document.getElementById("startTime").value;
	//alert(startTime);
	if(startTime.length==0)
	{
		document.getElementById("pstartTime").style.display = "inline-block";
		return false;
	}
	else
	{
		document.getElementById("pstartTime").style.display = "none";
	}
	
	
	
	var scoreUser = document.getElementById("scoreUsers").value;
	//alert(scoreUser);
	if(scoreUser.length==0)
	{
		document.getElementById("pscoreUser").style.display = "inline-block";
		return false;
	}
	else
	{
		document.getElementById("scoreUser").style.display = "none";
	}
}

	function moveOption(e1, e2) {
		try {
			for ( var i = 0; i < e1.options.length; i++) {
				if (e1.options[i].selected) {
					var e = e1.options[i];
					e2.options.add(new Option(e.text, e.value));
					e1.remove(i);
					i = i - 1;
				}
			}
			document.frm.scoreUsers.value = getvalue(document.frm.scoreUser);
		} catch (e) {
		}
	}

	function getvalue(geto) {
		var allvalue = "";
		for ( var i = 0; i < geto.options.length; i++) {
		  if(allvalue!="") allvalue += ",";
			allvalue += geto.options[i].value;
		}
		return allvalue;
	}
	
	$(document).ready(function() {
	   document.frm.scoreUsers.value = getvalue(document.frm.scoreUser);
	});
	
</script>
<form action="/project/editProject.do" method="post" name="frm">
<table width="90%" style="margin-top:20px;" border="0" align="center" cellpadding="10" cellspacing="0">
	<tr>
		<td>
		<div id="main">
			<h3>修改项目</h3>
			<fieldset>
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td width="9%" height="30" align="right">项目名称:</td>
				    	<td width="25%">&nbsp;
	        		  <input name="name" id="pname" type="text" class="text-long"  value="$!projectInfo.name"/><input name="id" type="hidden" value="$!projectInfo.id"></td>
					    <td width="15%" ><span id="pNameMsg" style="display:none; color:#FF0000; font-size:12px">*项目不能为空</span></td>
					    <td width="13%" align="right">建设单位:</td>
					    <td width="25%">&nbsp;
	        		  <input type="text"  name="buildUnit" class="text-long" value="$!projectInfo.buildUnit"/></td>
					    <td width="13%" style="color:#FF0000"></td>
					</tr>
					<tr>
                      <td height="30" align="right">施工单位:</td>
					  <td>&nbsp;
                          <input type="text"  name="constructUnit" class="text-long" value="$!projectInfo.constructUnit"/></td>
					  <td style="color:#FF0000"><span id="unitMsg" style="display:none; color:#FF0000; font-size:12px">*</span></td>
					  <td align="right">监理单位:</td>
					  <td>&nbsp;
                          <input type="text" name="supervisorUnit" class="text-long" value="$!projectInfo.supervisorUnit"/></td>
					  <td style="color:#FF0000"></td>
				  </tr>
					<tr>
                      <td height="30" align="right">设计单位:</td>
					  <td>&nbsp;
                          <input type="text"  name="designUnit"  class="text-long" value="$!projectInfo.designUnit"/></td>
					  <td style="color:#FF0000"></td>
					  <td align="right">开始评分时间:</td>
					  <td>&nbsp;
                          <input id="startTime" name="startTime" id="startTime" type="text" class="Wdate" value="$DateUtil.formatDate($!projectInfo.startTime,"yyyy-MM-dd")"/></td>
					  <td style="color:#FF0000"><span id="pstartTime" style="display:none; color:#FF0000; font-size:12px">*开始时间不能为空</span></td>
				  </tr>
					<tr>
					  <td height="30" align="right">选择评分人员:</td>
			          <td height="30" colspan="5" align="left">
                        <input type="hidden" name="scoreUsers" value="" />
												<select name="noScoreUsers" size="10" multiple="multiple"
													ondblclick="moveOption(document.frm.noScoreUsers, document.frm.scoreUser)">
													#foreach($user in $noScoreUserList)
													<option value="$user.id">
														$user.realName
													</option>
													#end
												</select>
												<input name="rightBtn" type="button" value=">>"
													onclick="moveOption(document.frm.noScoreUsers, document.frm.scoreUser)" />
												<input name="leftBtn" type=button value="<<"
													onclick="moveOption(document.frm.scoreUser, document.frm.noScoreUsers)" />
												<select name="scoreUser" size="10" multiple="multiple"
													ondblclick="moveOption(document.frm.scoreUser, document.frm.noScoreUsers)">
													#foreach($user in $scoreUserList)
													<option value="$user.id">
														$user.realName
													</option>
													#end
												</select>
                        <span id="pscoreUser"
                          style="display: none; color: #FF0000; font-size: 12px">*请选择评分人员</span>    
					  </td>
		          </tr>
					<tr>
					  <td height="50" align="right"><input type="submit"  name="submit" style="background:url(../images/button-submit.gif) left top no-repeat; border:none; cursor:pointer; width:94px; height:29px; line-height:29px; vertical-align:middle;" value="下一步" onclick="javascript:return checkFrom();"/></td>
				      <td>&nbsp;
				      <td></td>
				      <td></td>
				      <td></td>
				  </tr>
			</table>
			</fieldset>
		</div>
		</td>
	</tr>
</table>
</form>